<?php

namespace app\common\model;

use think\Model;

class StReservationAttr extends Model
{

    protected  $name = "st_reservation_attr";
    protected  $hidden =['update_time',''];
    //protected  $autoWriteTimestamp = true;// 自动写入时间戳


    /**获取当日用餐总分人数
     * @param $date
     * @param $type
     * @return StReservationAttr|float|int|string
     */
    public static function getStReservationAttrTotalNumber($date,$type){
        $map = [
            ['b.attr_name', '=', $type],
            ['b.attr_status', 'neq', 2],
            ['a.status','=', 1],
            ['a.comid', '=', COMID],
            ['a.date', '=', $date],
        ];
        $re = self::where($map)->alias('b')
            ->rightJoin("st_reservation a", 'a.id = b.mid')->count();
        return $re;
    }


}